<?php
set_time_limit(0);

class userGeneratorTask extends sfBaseTask
{
  protected function configure()
  {
    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
    ));

    $this->namespace        = 'generator';
    $this->name             = 'user';
    $this->briefDescription = '';
    $this->detailedDescription = '';
  }

  
  protected function execute($arguments = array(), $options = array())
  {
    // initialize the database connection
    $con=sfProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
    $context=sfContext::createInstance($con);
    $con->loadHelpers('Partial');
   
    $routing = $context->getRouting();
    
    $databaseManager = new sfDatabaseManager($this->configuration);
    $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();

    $this->logSection($this->name, 'Zaczynam generowac');
	
	require_once(dirname(__FILE__).'/../users.php');
		
	$ps=new UserGenerator();
	$this->logSection($this->name, 'Wygenerowalem'.$ps->Generate(500));
	
  }
}
